package com.hc.event.event02;

import com.hc.event.event01.MyCustomEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

/**
 * @Author: huangcheng
 * @CreateTime: 2023-09-06  10:13
 * @Description:
 * @Version: 1.0
 */
@Service
public class MyEventListener {
    @EventListener(MyCustomEvent.class)
    public void onApplicationEvent(MyCustomEvent event) {
        System.out.println("监听事件触发事件: "+event.getMessage());
        // 处理事件逻辑
    }
}
